const { createUser } = require("../../service/user/index");
class UseController {
  async regiest(ctx, next) {
    //获取前端传入结果
    const { user_name, password } = ctx.request.body;
    //操作数据库
    const res = await createUser(user_name, password);
    //返回给前端结果
    ctx.body = {
      code: 0,
      message: "用户注册成功",
      result: {
        id: res.id,
        user_name: res.user_name,
      },
    };
  }
}

module.exports = new UseController();
